﻿Imports System.Data.SqlClient

Public Class clsCUMULADO_ACTUALIZA
    Private cnConn As New SqlConnection
    Private Command As SqlCommand
  
    Public Sub CONECTA_BD()
        cnConn.ConnectionString = CitraConnection

        Command = New SqlCommand("ACTUALIZA_ACUMULADO", cnConn)
        Command.CommandType = CommandType.StoredProcedure
        Command.CommandTimeout = 0


        Command.Parameters.Add(New SqlParameter("@CLAVE", SqlDbType.Int))
        Command.Parameters.Add(New SqlParameter("@FECHA_ACTUAL", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@FECHA_INICIAL", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@FECHA_FINAL", SqlDbType.DateTime))
        Command.Parameters.Add(New SqlParameter("@TIPO", SqlDbType.Int))
        
        Try
            cnConn.Open()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End Try
    End Sub
    Public Sub GUARDA(ByVal CLAVE As Integer, ByVal FECHA_ACTUAL As Date, ByVal FECHA_INICIAL As Date, ByVal FECHA_FINAL As Date, ByVal TIPO As Integer)
        Command.Parameters("@CLAVE").Value = CLAVE
        Command.Parameters("@FECHA_ACTUAL").Value = FECHA_ACTUAL
        Command.Parameters("@FECHA_INICIAL").Value = FECHA_INICIAL
        Command.Parameters("@FECHA_FINAL").Value = FECHA_FINAL
        Command.Parameters("@TIPO").Value = TIPO

        Try
            Command.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")

        End Try
    End Sub
    Public Sub Cerrar_BD()
        If cnConn.State = ConnectionState.Open Then
            cnConn.Close()
        End If
    End Sub
End Class
